package DBHandler;

import java.util.LinkedList;


//probebly will change. this class should preform the querry and not DBHandler
//will make querries and selection of files (it is a mouse selection from gui, altumatelly..)
public class Searcher {
	
	//get singeltron db tool manager..
	DBHandler DBConnector = DBHandler.getInstance();
	
	LinkedList<SearcherObserver> observer_list;
	
	
	
	
	//SearchEx is an observer for this class.
	public void addObserver(SearcherObserver observer)
	{
		if (observer_list == null)
			observer_list = new LinkedList<SearcherObserver>();
		
		observer_list.add(observer);
	}
	
	
	public void search(String str)
	{
		System.out.println("preformed the search at DB");
		
		//notify change files
		for(SearcherObserver o: observer_list)
		{
			o.update();
		}
	}
	
	
	
	
	
	//add tag to a file (id str)
	public void addTag(String tag)
	{
		System.out.println("adding tag");
	}
	
	
	
	//remove tag from a file
	public void remTag(String tag)
	{
		System.out.println("removing tag");
	}
	
	
	
	//select a file (listener driven method!!)
	public void selectFile(String name)
	{
		
		DBConnector.select(name);
	}
	
}
